I am trying to use the Unix find
command in Python and can't get to input pwd
, `pwd`
did not work either.
import commands
import os
f = raw_input('Enter name of the file: ')
fh = open(f, 'r')
prevdir = os.getcwd()
files = fh.readlines()
for line in files:
os.chdir(line)
print commands.getoutput('find `pwd` -name "*.txt"')
# print commands.getoutput('find \`pwd\` -name "*.txt"')
Copyright Notice:Content Author:「Deep」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/36804405/using-unix-find-pwd